<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateContactsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('contacts', function (Blueprint $table) {
            $table->engine='InnoDB';
            $table->increments('id');
            $table->string('source',30)->comment('来源');
            $table->string('name',10)->comment('联系人名称');
            $table->string('company_name',30)->comment('公司名称');
            $table->string('industry',30)->comment('行业');
            $table->string('position',10)->comment('职务');
            $table->text('address')->comment('地址');
            $table->string('gender',4)->comment('性别');
            $table->string('phone',25)->comment('电话');
            $table->string('Micro',30)->comment('微信号');
            $table->string('email',30)->comment('邮箱');
            $table->boolean('is_customer')->default(false)->comment('是否为客户');
            $table->unsignedInteger('user_id')->nullable()->default(0)->comment('处理人');
            $table->foreign('user_id')->references('id')->on('admin_users')->onUpdate('cascade')->onDelete('cascade');
            $table->boolean('is_contact')->default(true)->comment('是否为主联系人');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('contacts');
    }
}
